class Borker():
    """
        任务对列
    """
    def __init__(self):
        self.func_list = []

    def add_func(self,func):

        self.func_list.append(func)


class Worker():
    """
        任务执行
    """

    def worker_func(self,broker,func):

        for fu in broker.func_list:
            if fu == func:
                fu()



class Celery():

    def __init__(self):
        self.broker=Borker()
        self.worker=Worker()

    def add(self,func):
        self.broker.func_list.append(func)

    def work(self,func):
        self.worker.worker_func(self.broker,func)

# 定义任务方法
def a_print():
    print('aaaaaa')

c=Celery()
c.add(a_print)
c.work(a_print)